package com.casic.ops.controller.pipeline;

import com.casic.ops.entity.request.pipeline.CommonPageRequest;
import com.casic.ops.entity.request.pipeline.PipelineNodeTemplateRequest;
import com.casic.ops.entity.vo.pipeline.response.Response;
import com.casic.ops.service.api.pipeline.PipelineNodeTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 流水线节点类型controller
 * @author mikey
 * @date 2022-02-26 00:19:20
 */
@RestController
@Api(tags = "流水线节点类型模块",description = "包含新增/列表/删除")
@RequestMapping("ops/api/pipeline/node")
public class PipelineNodeTemplateController  {
    @Resource
    private PipelineNodeTemplateService pipelineNodeTemplateService;

    @PostMapping("/add")
    @ApiOperation(value = "添加",httpMethod = "POST")
    public Response add(@RequestBody PipelineNodeTemplateRequest pipelineNodeTemplateRequest) {
        return pipelineNodeTemplateService.add(pipelineNodeTemplateRequest);
    }

    @DeleteMapping("/delete")
    @ApiOperation(value = "删除",httpMethod = "DELETE")
    public Response delete(@RequestBody Long[] ids){
        return pipelineNodeTemplateService.delete(ids);
    }

    @GetMapping("/page")
    @ApiOperation(value = "列表",httpMethod = "GET")
    public Response page(@RequestBody CommonPageRequest request){
        return pipelineNodeTemplateService.page(request);
    }

    @GetMapping("/list")
    @ApiOperation(value = "列表",httpMethod = "GET")
    public Response list(){
        return pipelineNodeTemplateService.list();
    }

    @GetMapping("/info")
    @ApiOperation(value = "详情",httpMethod = "GET")
    public Response info(@RequestBody Long id){
        return pipelineNodeTemplateService.getById(id);
    }

    @PutMapping("/update")
    @ApiOperation(value = "更新",httpMethod = "PUT")
    public Response update(@RequestBody PipelineNodeTemplateRequest pipelineNodeTemplateRequest){
        return pipelineNodeTemplateService.update(pipelineNodeTemplateRequest);
    }
}
